package com.niiwoo.activity.stage.enums.prize;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description
 * @Author zq
 * @Date 2017/12/4
 */
@AllArgsConstructor
@Getter
public enum UserPrizeFromTypeEnum {

    // 1代表运营活动，2代表人工添加 3系统发送
    FROM_ACTIVTIY((byte) 1, "运营活动"),
    FROM_MANAGER((byte) 2, "人工添加"),
    FROM_SYSTEM((byte) 3, "系统发送");


    private final Byte type;
    private final String desc;

    public static UserPrizeFromTypeEnum getEnumByFromType(Byte fromTypeId) {
        if (fromTypeId == null) {
            return FROM_MANAGER;
        }
        for (UserPrizeFromTypeEnum fromTypeEnum : UserPrizeFromTypeEnum.values()) {
            if (fromTypeEnum.getType().equals(fromTypeId)) {
                return fromTypeEnum;
            }
        }
        return null;
    }

}
